package com.wanghengzhi.girlfriend.rbac.module.account.dto;

import com.wanghengzhi.girlfriend.rbac.module.validator.AddValidator;
import com.wanghengzhi.girlfriend.rbac.module.validator.UpdateValidator;
import lombok.Data;

import javax.validation.constraints.*;

/**
 * @author 王潇
 * @since
 */
@Data
public class AccountInputDTO {

    /**
     * id 修改信息时使用
     */
    @NotNull(message = "修改账号信息时，id 不能为空!", groups = UpdateValidator.class)
    @Min(value = 1, message = "id值不在unsigned int范围内！")
    @Max(value = Integer.MAX_VALUE, message = "id值不在unsigned int范围内！")
    private Integer id;

    /**
     * 用户账号，字母数字、邮箱、电话等
     */
    @Pattern(regexp = "[0-9a-zA-Z]*", message = "账号只能是字母和数字组成！")
    @Size(min = 6, max = 20, message = "账号长度范围为6-20个有效字符！")
    @NotEmpty(message = "账号不能为空！")
    private String account;

    /**
     * 密码
     */
    @Size(min = 6, max = 20, message = "密码长度范围为6-20个有效字符！", groups = AddValidator.class)
    @NotEmpty(message = "密码不能为空！", groups = AddValidator.class)
    private String password;

}
